package com.wuhunyu.servicebase.exception;

import lombok.extern.slf4j.Slf4j;

/**
 * 全局异常处理类
 *
 * @author wuhunyu
 * @version 1.0
 * @date 2021-01-13 12:08
 */
@Slf4j
public class Assert {

    /**
     * 异常处理
     * @param flag
     * @param msg
     * @throws Exception
     */
    public static void isRight(boolean flag, String msg) {
        if (flag) {
            // 抛出空值异常
            throw new NullException(msg);
        }
    }

    public static void isRight(boolean flag) {
        if (flag) {
            // 抛出空值异常
            throw new NullException("空值异常");
        }
    }

}
